<template>
	<view class="mainpadding">
		<u-modal :show="show" cancelColor="#555" confirmColor="#FAB536" :showCancelButton="true" :title="title"
			@cancel="cancel" @confirm="confirm"></u-modal>
		<view class="flexbetween xiahuax" @click="tzshdz">
			<view class="notitletext">收货地址</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="tzxgmm">
			<view class="notitletext">修改密码</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" v-if="personInfo.realname_status!=3" @click="tzsmrz">
			<view class="notitletext">实名认证</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="tzbdwx">
			<view class="notitletext">微信绑定</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="tzzfbxx">
			<view class="notitletext">支付宝信息</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="tzyhkbd">
			<view class="notitletext">银行卡信息</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="tzyjfk">
			<view class="notitletext">意见反馈</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="yizygy(2)">
			<view class="notitletext">隐私政策</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="yizygy(1)">
			<view class="notitletext">用户协议</view>
			<view class="righticon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="yizygy(3)">
			<view class="notitletext">关于我们</view>
			<view class="righticon"></view>
		</view>
		<view class="gudingdb">
			<view class="bigbtn" @click="show = true">退出登录</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				title: '确定要退出当前账户么？',
				personInfo:{
					realname_status:""
				},
			}
		},
		onShow() {
			this.getinfo()
		},
		methods: {
			getinfo() {
				httpRequest.request('/api/user/index', 'POST', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.personInfo = res.data
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			// 跳转收货地址
			tzshdz(){
				uni.navigateTo({
					url: '/pages/mypage/shouhuodiz'
				})
			},
			// 跳转用户协议，隐私政策，关于我们
			yizygy(i){
				uni.navigateTo({
					url: '/pages/mypage/guanyuwomen?id='+i
				})
			},
			// 跳转意见反馈
			tzyjfk() {
				uni.navigateTo({
					url: '/pages/mypage/yijianfk'
				})
			},
			// 跳转银行卡绑定
			tzyhkbd() {
				uni.navigateTo({
					url: '/pages/mypage/yinhangkbd'
				})
			},
			// 跳转支付宝信息
			tzzfbxx() {
				uni.navigateTo({
					url: '/pages/mypage/xiugaizfb'
				})
			},
			// 跳转绑定微信
			tzbdwx() {
				uni.navigateTo({
					url: '/pages/mypage/bangdwx'
				})
			},
			// 跳转修改密码
			tzxgmm() {
				uni.navigateTo({
					url: '/pages/mypage/xiugaimm'
				})
			},
			// 跳转实名认证
			tzsmrz() {
				if(this.personInfo.realname_status==2){
					httpRequest.toast("审核中，无法进行此类操作")
					return false
				}
				uni.navigateTo({
					url: '/pages/mypage/shimingrz'
				})
			},
			cancel() {
				this.show = false
			},
			confirm() {
				this.show = false;
				// 将存储的数据改为空达到退出登录的效果
				uni.setStorageSync('token', "");
				httpRequest.toast("退出登录成功")
				setTimeout(() => {
					// uni.navigateBack(1)
					uni.reLaunch({
						url:'/pages/mypage/mypage'
					})
				}, 1000)
			},

		}
	}
</script>

<style lang="scss" scoped>
	.xiahuax {
		padding: 20rpx 0;
		border-bottom: 2rpx solid rgba(153, 153, 153, 0.05);
	}
</style>
